import { EntitySchema } from '@mikro-orm/core';

export class LeTaskGoods {
  id!: string;
  goodsId!: string;
  taskStock!: string;
  taskNumber!: string;
  taskPrice?: string;
  taskLimit?: string;
  goodsIsSale: boolean = false;
  isRecycle?: boolean = false;
  isDeleted?: number = 0;
  createdTime?: number = 0;
  updatedTime?: number = 0;
  deletedTime?: number = 0;
  taskStatus?: boolean = false;
}

export const LeTaskGoodsSchema = new EntitySchema({
  class: LeTaskGoods,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    goodsId: { type: 'string', columnType: 'bigint' },
    taskStock: { type: 'string', columnType: 'bigint' },
    taskNumber: { type: 'string', columnType: 'bigint' },
    taskPrice: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    taskLimit: { type: 'string', columnType: 'bigint', nullable: true },
    goodsIsSale: { type: 'boolean', default: false },
    isRecycle: { type: 'boolean', nullable: true, default: false },
    isDeleted: { type: 'number', columnType: 'tinyint', nullable: true, default: 0 },
    createdTime: { type: 'number', nullable: true, default: 0 },
    updatedTime: { type: 'number', nullable: true, default: 0 },
    deletedTime: { type: 'number', nullable: true, default: 0 },
    taskStatus: { type: 'boolean', nullable: true, default: false },
  },
});
